// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import Vuex from 'vuex'
import VueRouter from 'vue-router'
import BScroll from 'better-scroll'
import axios from 'axios'
import VueAxios from 'vue-axios'
import 'mint-ui/lib/style.css'
import MintUI from 'mint-ui'
Vue.use(MintUI)
import { Toast, TabContainer, TabContainerItem, Loadmore, Lazyload, Popup, Cell,Actionsheet  } from 'mint-ui';
import Page from '@/base/page/page'


import config from '@/config/config';
// 引入时间选择器插件
import Calendar from './modules/index';
//import WeixinLogin from "@/components/weixin-login/weixin-login"
//import PhoneLogin from "@/components/phone-login/phone-login"
import LoginModel from "@/components/login-model/login-model"
//Vue.component("weixin-login",WeixinLogin);
//Vue.component("phone-login",PhoneLogin);
Vue.component("login-model",LoginModel);

Vue.use(Calendar);

Vue.use(VueAxios, axios)

Vue.use(VueRouter)
Vue.use(Vuex)
Vue.use(MintUI)
Vue.use(Loadmore)
Vue.use(Lazyload)
Vue.use(Popup)
Vue.use(Cell)
Vue.component(Actionsheet.name, Actionsheet);

Vue.config.productionTip = false

Vue.component(Page.name, Page)
Vue.component(TabContainer.name, TabContainer);
Vue.component(TabContainerItem.name, TabContainerItem);
import store from './store/store.js'
/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  store,
  components: { App },
  template: '<App/>'
})
// 前进刷新，后退缓存
router.beforeEach((to, from, next) => {
	const toDepth = to.path.split('/').length
	const fromDepth = from.path.split('/').length
	// 定制页面永远不刷新
	if(to.path == "/customization"){
		next()
		return;
	}
	if(toDepth < fromDepth) {
		from.meta.keepAlive = false
		to.meta.keepAlive = true
	}
	next()
})